<template>
  <div>
    <HomeHeader />
    <van-tabs background="#e4e4e4" scroll sticky>
      <van-tab
        :title="category.name"
        v-for="category in categoryList"
        :key="category.id"
      >
        <CategoryContent :num="category.id" />
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import HomeHeader from "../components/HomeHeader";
import CategoryContent from "../components/CategoryContent";
export default {
  data() {
    return {
      categoryList: [],
    };
  },
  components: {
    HomeHeader,
    CategoryContent,
  },

  created() {
    this.$axios({
      url: "/category",
    }).then((res) => {
      // console.log(res.data);
      this.categoryList = res.data.data;
      console.log(this.categoryList, "分类");
    });
  },
};
</script>

<style lang="less" scoped></style>
